{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">其他支出</div>
    <div class="layui-card-header">支出总额：<span style="color: red;font-size: 18px" id="payMoneyContainer"></span></div>

    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                data-auth-add="{:$auth->check('other/add')}" 
                data-auth-edit="{:$auth->check('other/edit')}"
                data-auth-delete="{:$auth->check('other/del')}"
                data-auth-recyclebin="{:$auth->check('other/recyclebin')}"
                ></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: '{:url("add")}',
        edit_url: '{:url("edit")}',
        delete_url: '{:url("del")}',
        modify_url: "{:url('multi')}",
        recyclebin_url: "{:url('recyclebin')}",
    };

    table.render({
        init: init,
        toolbar: ['refresh', 'add', 'delete'],
        url: '{:url("index")}',
        cols: [
            [
               {type: 'checkbox', fixed: 'left' },
               {field: 'id', align: 'center', title: 'id',minWidth:80},
                {field: 'date', align: 'center', title: '日期',minWidth:80, searchOp: 'LIKE',minWidth:110},

                {field: 'title', align: 'center', title: '标题',minWidth:80, searchOp: 'LIKE',minWidth:110},
               {field: 'money', align: 'center', title: '金额',minWidth:80, search: 'between',searchTip:'金额'},
               {field: 'username', align: 'center', title: '人员',minWidth:80, searchOp: 'LIKE',minWidth:110},
               {field: 'notes', align: 'center', title: '备注',minWidth:80, searchOp: 'LIKE',minWidth:110},
               {field: 'create_time', title: '创建时间',minWidth:80,width:180, search: 'range', templet: yznTable.formatter.datetime},
               {fixed: 'right',width:90, search: false,field: 'operate', title: '操作',templet: yznTable.formatter.tool,operat: ['edit','delete']}
            ]
        ],
        done: function (res, curr, count) {
            var payMoney = res.payMoney;
            // 将 payMoney 渲染到页面的某个元素中
            $('#payMoneyContainer').text(payMoney + "元");
        },
        page: {}
    });

    yznTable.bindevent();
});
</script>
{/block}